//
//  PersonVC.m
//  NewProject
//
//  Created by 李航飞 on 2017/6/4.
//  Copyright © 2017年 李航飞. All rights reserved.
//

#import "PersonVC.h"
#import "ShopCollectTableViewController.h"
#import "FeedBackVC.h"
#import "SettingViewController.h"
#import "NewsViewController.h"
#import "InformationViewController.h"
#import "MyAddressViewController.h"
@interface PersonVC ()<InformationDelegate>
@property(nonatomic,strong)NSDictionary *netDictionary;
@property(nonatomic,strong)UILabel *nameLabel;
@property(nonatomic,strong)UIImageView *headImageView;
@property(nonatomic,strong)UILabel *vipLabel;
@property(nonatomic,strong)UILabel *yueLabel;
@property(nonatomic,strong)UILabel *bonusLabel;
@property(nonatomic,strong)UILabel *jifenLabel;
@property(nonatomic,strong)InformationViewController *infoVC;
@property (nonatomic,strong) NSString *myId;
@property (nonatomic, strong) NSDictionary *dic;
@end

@implementation PersonVC
- (NSDictionary *)netDictionary{
    if (!_netDictionary) {
        _netDictionary = [[NSDictionary alloc]init];
    }
    return _netDictionary;
}

- (void)httpGetData{
    [[MyNetWorking sharedManager]GET_PATH:@"g=portal&m=buyer&a=personal&id=1" success:^(id responseObject) {
        self.netDictionary = responseObject[0];
        [self refreshData];
        NSLog(@"%@",self.netDictionary);
    } failure:^(NSError *error) {
        NSLog(@"%@",error);
    }];
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.navigationController.navigationBarHidden=YES;
    _infoVC = [[InformationViewController alloc]init];
//    self.tabBarController.tabBar.hidden=NO;
}

- (void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    self.navigationController.navigationBarHidden=NO;
    self.navigationController.navigationBar.translucent = NO;
//    self.tabBarController.tabBar.hidden=YES;
}

- (void)refreshInfoData{
    [self httpGetData];
}

- (void)refreshData{
    _nameLabel.text = self.netDictionary[@"username"];
    _nameLabel.text = self.netDictionary[@"nicheng"];
    [_headImageView sd_setImageWithURL:[NSURL URLWithString:SF(@"%@%@",IMAGEURL,self.netDictionary[@"touxiang"])] placeholderImage:[UIImage imageNamed:@""]];
    _vipLabel.text = SF(@"%@会员",self.netDictionary[@"level"]);
    _yueLabel.text = checkStringNull(self.netDictionary[@"yue"]);
    _bonusLabel.text = self.netDictionary[@"bonus"];
    _jifenLabel.text = self.netDictionary[@"jifen"];
//    [_infoVC refreshData:self.netDictionary];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.automaticallyAdjustsScrollViewInsets = NO;
    NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
    _myId = [ user objectForKey:@"myId"];
    [self firstGetMessage];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor colorWithRed:250/255.0 green:250/255.0 blue:250/255.0 alpha:1];
//    self.view.backgroundColor=[UIColor whiteColor];
    self.navigationItem.title = @"个人中心";
    //self.title=@"个人中心";
    [self setUpView];
}
- (void)firstGetMessage{
    AFHTTPSessionManager*manager=[AFHTTPSessionManager manager];
    manager.responseSerializer.acceptableContentTypes = nil;
    manager.requestSerializer=[AFHTTPRequestSerializer serializer];
    manager.responseSerializer=[AFHTTPResponseSerializer serializer];
    manager.requestSerializer = [AFJSONRequestSerializer serializer];
    manager.responseSerializer = [AFJSONResponseSerializer serializer];
    manager.responseSerializer.acceptableContentTypes =  [NSSet setWithObjects:@"application/json", @"text/html",@"text/json",@"text/javascript",@"text/plain", nil];
    
    NSString*urlstr=[NSString stringWithFormat:@"http://www.lnwuyou.com/sc/index.php?g=portal&m=buyer&a=personal&id=%@",_myId];
    [manager GET:urlstr parameters:nil  progress:nil success:^(NSURLSessionDataTask *operation, id responseObject) {
        NSLog(@"111%@",responseObject);
        _dic=[[NSDictionary alloc]init];
        _dic=responseObject[@"data"][0];
        if([responseObject[@"status"] isEqualToString:@"1"]){
//            [self setUpView];
            if (![_dic[@"touxiang"] isEqual:@""]) {
                _touxiangImg.image=[UIImage imageNamed:_dic[@"touxiang"]];
            }
            if (![_dic[@"username"] isEqual:@""]) {
                _mobile.text=_dic[@"username"];
            }
            if (![_dic[@"yue"] isEqual:@""]) {
                _firstLab.text=_dic[@"yue"];
            }
            if (![_dic[@"bonus"] isEqual:@""]) {
                _thirdLab.text=_dic[@"bonus"];
            }
            if (![_dic[@"jifen"] isEqual:@""]) {
                _fiveLab.text=_dic[@"jifen"];
            }
            if (![_dic[@"level"] isEqual:@""]) {
                _huiyuan.text=_dic[@"level"];
            }

        }else{
            UIAlertView*alert = [[UIAlertView alloc] initWithTitle:@""
                                                           message:responseObject[@"msg"] delegate:self
                                                 cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
            [alert show];
        }
        
    } failure:^(NSURLSessionDataTask *operation, NSError *error) {
        NSLog(@"Error: %@", error);
        NSLog(@"请求出错了: - %@ \n%@",
              [error localizedDescription],
              [[error userInfo] objectForKey:NSURLErrorFailingURLStringErrorKey]);
    }];
}
- (void)setUpView{
    
    UIScrollView*scrollView=[[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height-49)];
    scrollView.bounces=NO;
    scrollView.delegate=self;
    [self.view addSubview:scrollView];
    [scrollView setShowsVerticalScrollIndicator:NO];
    
    UIImageView *firstView=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 200)];
    [firstView setImage:[UIImage imageNamed:@"bg"]];
    firstView.userInteractionEnabled = YES;
    [scrollView addSubview:firstView];
    
    _headImageView =[[UIImageView alloc] initWithFrame:CGRectMake((self.view.frame.size.width-55)/2, 60, 55, 55)];
    _headImageView.userInteractionEnabled = YES;
    [firstView addSubview:_headImageView];
    _headImageView.layer.cornerRadius = 27.5;
    [_headImageView.layer setMasksToBounds:YES];
    _headImageView.backgroundColor = [UIColor whiteColor];
    [_headImageView setImage:[UIImage imageNamed:@"头像"]];
    
    UIButton *touxiangButton = [[UIButton alloc]initWithFrame:CGRectMake((self.view.frame.size.width-55)/2, 60, 55, 55)];
    [touxiangButton addTarget:self action:@selector(touxiangButtonClick) forControlEvents:UIControlEventTouchUpInside];
    touxiangButton.alpha = 1;
    [firstView addSubview:touxiangButton];
    
    _nameLabel=[[UILabel alloc] initWithFrame:CGRectMake(self.view.frame.size.width/3, _headImageView.frame.origin.y+_headImageView.frame.size.height+5, self.view.frame.size.width/3, 25)];
    [firstView addSubview:_nameLabel];
    _nameLabel.textAlignment = NSTextAlignmentCenter;
    _nameLabel.text=@"15890387892";
    _nameLabel.textColor=[UIColor whiteColor];
    
    _vipLabel=[[UILabel alloc] initWithFrame:CGRectMake((self.view.frame.size.width-55)/2, _nameLabel.frame.origin.y+_nameLabel.frame.size.height+5, 55, 15)];
    [firstView addSubview:_vipLabel];
    [_vipLabel setFont:[UIFont systemFontOfSize:10]];
    _vipLabel.backgroundColor=RGB0X(0xF8F9F6);
    _vipLabel.textAlignment = NSTextAlignmentCenter;
    _vipLabel.text=@"VD会员";
    _vipLabel.textColor=[UIColor blackColor];
    
    UIButton *leftBtn=[[UIButton alloc] initWithFrame:CGRectMake(20, 20, 20, 20)];
    [leftBtn setImage:[UIImage imageNamed:@"shezhix2"] forState:UIControlStateNormal];
    [leftBtn addTarget:self action:@selector(leftButtonClick) forControlEvents:UIControlEventTouchUpInside];
    [firstView addSubview:leftBtn];
    
    UIButton *rightBtn=[[UIButton alloc] initWithFrame:CGRectMake(self.view.frame.size.width-40, 20, 20, 20)];
    [rightBtn addTarget:self action:@selector(rightButtonClick) forControlEvents:UIControlEventTouchUpInside];
    [rightBtn setImage:[UIImage imageNamed:@"xiaoxix2"] forState:UIControlStateNormal];
    [firstView addSubview:rightBtn];

    
    UIView *secondView=[[UIView alloc] initWithFrame:CGRectMake(0, firstView.frame.size.height, self.view.frame.size.width, 80)];
    secondView.backgroundColor=[UIColor whiteColor];
    [scrollView addSubview:secondView];
    _yueLabel=[[UILabel alloc] initWithFrame:CGRectMake(0, 20, self.view.frame.size.width/3, 20)];
    _yueLabel.text=@"0.00";
    _yueLabel.textAlignment = NSTextAlignmentCenter;
    _yueLabel.textColor=[UIColor blackColor];
    _yueLabel.font=[UIFont systemFontOfSize:18];
    [secondView addSubview:_yueLabel];
    
    UILabel *secondLab=[[UILabel alloc] initWithFrame:CGRectMake(0, _yueLabel.frame.size.height+_yueLabel.frame.origin.y, self.view.frame.size.width/3, 20)];
    secondLab.text=@"余额";
    secondLab.textAlignment = NSTextAlignmentCenter;
    secondLab.textColor=[UIColor colorWithRed:201/255.0 green:200/255.0 blue:200/255.0 alpha:1];
    secondLab.font=[UIFont systemFontOfSize:10];
    [secondView addSubview:secondLab];
    
    
    _bonusLabel=[[UILabel alloc] initWithFrame:CGRectMake(_yueLabel.frame.size.width, 20, self.view.frame.size.width/3, 20)];
    _bonusLabel.text=@"0";
    _bonusLabel.textAlignment = NSTextAlignmentCenter;
    _bonusLabel.textColor=[UIColor blackColor];
    _bonusLabel.font=[UIFont systemFontOfSize:18];
    [secondView addSubview:_bonusLabel];
    
    UILabel *fourthLab=[[UILabel alloc] initWithFrame:CGRectMake(_yueLabel.frame.size.width, _yueLabel.frame.size.height+_yueLabel.frame.origin.y, self.view.frame.size.width/3, 20)];
    fourthLab.text=@"优惠券";
    fourthLab.textAlignment = NSTextAlignmentCenter;
    fourthLab.textColor=[UIColor colorWithRed:201/255.0 green:200/255.0 blue:200/255.0 alpha:1];
    fourthLab.font=[UIFont systemFontOfSize:10];
    [secondView addSubview:fourthLab];
    
    
    _jifenLabel=[[UILabel alloc] initWithFrame:CGRectMake(_yueLabel.frame.size.width*2, 20, self.view.frame.size.width/3, 20)];
    _jifenLabel.text=@"0";
    _jifenLabel.textAlignment = NSTextAlignmentCenter;
    _jifenLabel.textColor=[UIColor blackColor];
    _jifenLabel.font=[UIFont systemFontOfSize:18];
    [secondView addSubview:_jifenLabel];
    
    UILabel *sixLab=[[UILabel alloc] initWithFrame:CGRectMake(_yueLabel.frame.size.width*2, _yueLabel.frame.size.height+_yueLabel.frame.origin.y, self.view.frame.size.width/3, 20)];
    sixLab.text=@"积分";
    sixLab.textAlignment = NSTextAlignmentCenter;
    sixLab.textColor=[UIColor colorWithRed:201/255.0 green:200/255.0 blue:200/255.0 alpha:1];
    sixLab.font=[UIFont systemFontOfSize:10];
    [secondView addSubview:sixLab];
    
    UIView *dingdanView=[[UIView alloc] initWithFrame:CGRectMake(0, secondView.frame.size.height+secondView.frame.origin.y+10, self.view.frame.size.width, 120)];
    dingdanView.backgroundColor=[UIColor whiteColor];
    [scrollView addSubview:dingdanView];
    
    UIView *myDindDan=[[UIView alloc] initWithFrame:CGRectMake(0,0, self.view.frame.size.width, 45)];
    [dingdanView addSubview:myDindDan];
    UILabel *myLab=[[UILabel alloc] initWithFrame:CGRectMake(20, 0, self.view.frame.size.width/2, 45)];
    myLab.text=@"我的订单";
    myLab.textAlignment = UITextAlignmentLeft;
    myLab.textColor=[UIColor blackColor];
    myLab.font=[UIFont systemFontOfSize:14];
    [myDindDan addSubview:myLab];
    
    UILabel *allDingDan =[[UILabel alloc] initWithFrame:CGRectMake(self.view.frame.size.width/2+20, 0, self.view.frame.size.width/2-40, 45)];
     allDingDan.textAlignment = UITextAlignmentRight;
    [myDindDan addSubview:allDingDan];
    
    NSMutableAttributedString *attri2 =    [[NSMutableAttributedString alloc] initWithString:@"查看全部订单  "];
    
    NSTextAttachment *attch2 = [[NSTextAttachment alloc] init];
    
    attch2.image = [UIImage imageNamed:@"youx2"];
    
    attch2.bounds = CGRectMake(0, 0, 10, 10);
    NSAttributedString *string2 = [NSAttributedString attributedStringWithAttachment:attch2];
    
    
    [attri2 insertAttributedString:string2 atIndex:[attri2 length]];
    allDingDan.textColor=[UIColor colorWithRed:201/255.0 green:200/255.0 blue:200/255.0 alpha:1];
    [allDingDan setFont:[UIFont systemFontOfSize:14]];
    allDingDan.attributedText = attri2;
    
    UIView *line1=[[UIView alloc] initWithFrame:CGRectMake(0, myLab.frame.origin.y+myLab.frame.size.height, self.view.frame.size.width, 1)];
    line1.backgroundColor=LINE_COLOE_245;
    [myDindDan addSubview:line1];
    
    UIView *daiFuKuan=[[UIView alloc] initWithFrame:CGRectMake(0, 45, self.view.frame.size.width/4, 75)];
    [myDindDan addSubview:daiFuKuan];
    
    UIImageView *daiFuKuanImg=[[UIImageView alloc] initWithFrame:CGRectMake((daiFuKuan.frame.size.width-24)/2, daiFuKuan.frame.size.height/2-24, 24, 24)];
    [daiFuKuanImg setImage:[UIImage imageNamed:@"daifux2"]];
    [daiFuKuan addSubview:daiFuKuanImg];
    
    UILabel *daiFuKuanLab=[[UILabel alloc] initWithFrame:CGRectMake(0, daiFuKuanImg.frame.size.height+daiFuKuanImg.frame.origin.y, daiFuKuan.frame.size.width, daiFuKuan.frame.size.height/2)];
    daiFuKuanLab.text=@"待付款";
    daiFuKuanLab.textAlignment = UITextAlignmentCenter;
    [daiFuKuanLab setFont:[UIFont systemFontOfSize:14]];
    daiFuKuanLab.textColor=[UIColor blackColor];
    [daiFuKuan addSubview:daiFuKuanLab];
    
    UIView *daiShouHuo=[[UIView alloc] initWithFrame:CGRectMake(self.view.frame.size.width/4, 45, self.view.frame.size.width/4, 75)];
    [myDindDan addSubview:daiShouHuo];
    
    UIImageView *daiShouHuoImg=[[UIImageView alloc] initWithFrame:CGRectMake((daiShouHuo.frame.size.width-24)/2, daiShouHuo.frame.size.height/2-24, 24, 24)];
    [daiShouHuoImg setImage:[UIImage imageNamed:@"daishoux2"]];
    [daiShouHuo addSubview:daiShouHuoImg];
    
    UILabel *daiShouHuoLab=[[UILabel alloc] initWithFrame:CGRectMake(0, daiShouHuoImg.frame.size.height+daiShouHuoImg.frame.origin.y, daiShouHuo.frame.size.width, daiShouHuo.frame.size.height/2)];
    daiShouHuoLab.text=@"待收货";
    daiShouHuoLab.textAlignment = UITextAlignmentCenter;
    [daiShouHuoLab setFont:[UIFont systemFontOfSize:14]];
    daiShouHuoLab.textColor=[UIColor blackColor];
    [daiShouHuo addSubview:daiShouHuoLab];
    
    UIView *daiPingJia=[[UIView alloc] initWithFrame:CGRectMake(self.view.frame.size.width/4*2, 45, self.view.frame.size.width/4, 75)];
    [myDindDan addSubview:daiPingJia];
    
    UIImageView *daiPingJiaImg=[[UIImageView alloc] initWithFrame:CGRectMake((daiPingJia.frame.size.width-24)/2, daiPingJia.frame.size.height/2-24, 24, 24)];
    [daiPingJiaImg setImage:[UIImage imageNamed:@"daipingx2"]];
    [daiPingJia addSubview:daiPingJiaImg];
    
    UILabel *daiPingJiaLab=[[UILabel alloc] initWithFrame:CGRectMake(0, daiPingJiaImg.frame.size.height+daiPingJiaImg.frame.origin.y, daiPingJia.frame.size.width, daiPingJia.frame.size.height/2)];
    daiPingJiaLab.text=@"待评价";
    daiPingJiaLab.textAlignment = UITextAlignmentCenter;
    [daiPingJiaLab setFont:[UIFont systemFontOfSize:14]];
    daiPingJiaLab.textColor=[UIColor blackColor];
    [daiPingJia addSubview:daiPingJiaLab];
    
    UIView *tuikuan=[[UIView alloc] initWithFrame:CGRectMake(self.view.frame.size.width/4*3, 45, self.view.frame.size.width/4, 75)];
    [myDindDan addSubview:tuikuan];
    
    UIImageView *tuikuanImg=[[UIImageView alloc] initWithFrame:CGRectMake((tuikuan.frame.size.width-24)/2, tuikuan.frame.size.height/2-24, 24, 24)];
    [tuikuanImg setImage:[UIImage imageNamed:@"daishoux2"]];
    [tuikuan addSubview:tuikuanImg];
    
    UILabel *tuikuanLab=[[UILabel alloc] initWithFrame:CGRectMake(0, tuikuanImg.frame.size.height+tuikuanImg.frame.origin.y, tuikuan.frame.size.width, tuikuan.frame.size.height/2)];
    tuikuanLab.text=@"退款 售后";
    tuikuanLab.textAlignment = UITextAlignmentCenter;
    [tuikuanLab setFont:[UIFont systemFontOfSize:14]];
    tuikuanLab.textColor=[UIColor blackColor];
    [tuikuan addSubview:tuikuanLab];
    
    UIView *huiYuan=[[UIView alloc] initWithFrame:CGRectMake(0, dingdanView.frame.size.height+dingdanView.frame.origin.y+10, self.view.frame.size.width/2, 75*kScrenWidth)];
    huiYuan.backgroundColor=[UIColor whiteColor];
    [scrollView addSubview:huiYuan];
    UIImageView *huiYuanImg=[[UIImageView alloc] initWithFrame:CGRectMake(30*kScrenWidth, (huiYuan.frame.size.height-30*kScrenHidth)/2, 30*kScrenWidth, 30*kScrenWidth)];
    [huiYuanImg setImage:[UIImage imageNamed:@"huiyuanx2"]];
    huiYuanImg.layer.cornerRadius = 15*kScrenWidth;
    [huiYuanImg.layer setMasksToBounds:YES];
    [huiYuan addSubview:huiYuanImg];
    
    UILabel *huiYuanZhongXin=[[UILabel alloc] initWithFrame:CGRectMake(huiYuanImg.frame.size.width+huiYuanImg.frame.origin.x+15, 5, huiYuan.frame.size.width-(huiYuanImg.frame.size.width+huiYuanImg.frame.origin.x)-15, huiYuan.frame.size.height/2-5)];
    huiYuanZhongXin.text=@"会员中心";
    huiYuanZhongXin.textColor=[UIColor blackColor];
    huiYuanZhongXin.font=[UIFont systemFontOfSize:14];
    [huiYuan addSubview:huiYuanZhongXin];
    
    UILabel *chaKanHuiYuan=[[UILabel alloc] initWithFrame:CGRectMake(huiYuanZhongXin.frame.origin.x, huiYuanZhongXin.frame.size.height+huiYuanZhongXin.frame.origin.y, huiYuanZhongXin.frame.size.width, huiYuanZhongXin.frame.size.height)];
    chaKanHuiYuan.text=@"查看会员特权";
    chaKanHuiYuan.textColor=[UIColor colorWithRed:201/255.0 green:200/255.0 blue:200/255.0 alpha:1];
    chaKanHuiYuan.font=[UIFont systemFontOfSize:12];
    [huiYuan addSubview:chaKanHuiYuan];
    
    UIView *huiYuanLine=[[UIView alloc] initWithFrame:CGRectMake(self.view.frame.size.width/2-1, huiYuan.frame.origin.y, 1, huiYuan.frame.size.height)];
    huiYuanLine.backgroundColor=[UIColor colorWithRed:201/255.0 green:200/255.0 blue:200/255.0 alpha:1];
    [scrollView addSubview:huiYuanLine];
    
    UIView *jiFenShangCheng=[[UIView alloc] initWithFrame:CGRectMake(self.view.frame.size.width/2, huiYuan.frame.origin.y, self.view.frame.size.width/2, 75*kScrenWidth)];
    jiFenShangCheng.backgroundColor=[UIColor whiteColor];
    [scrollView addSubview:jiFenShangCheng];
    UIImageView *jiFenShangChengImg=[[UIImageView alloc] initWithFrame:CGRectMake(30*kScrenWidth, (jiFenShangCheng.frame.size.height-30*kScrenHidth)/2, 30*kScrenWidth, 30*kScrenWidth)];
    [jiFenShangChengImg setImage:[UIImage imageNamed:@"jifenx2"]];
    jiFenShangChengImg.layer.cornerRadius = 15*kScrenWidth;
    [jiFenShangChengImg.layer setMasksToBounds:YES];
    [jiFenShangCheng addSubview:jiFenShangChengImg];
    
    UILabel *jiFenShangChengLab=[[UILabel alloc] initWithFrame:CGRectMake(jiFenShangChengImg.frame.size.width+jiFenShangChengImg.frame.origin.x+15, 5, jiFenShangCheng.frame.size.width-(jiFenShangChengImg.frame.size.width+huiYuanImg.frame.origin.x)-15, jiFenShangCheng.frame.size.height/2-5)];
    jiFenShangChengLab.text=@"积分商城";
    jiFenShangChengLab.textColor=[UIColor blackColor];
    jiFenShangChengLab.font=[UIFont systemFontOfSize:14];
    [jiFenShangCheng addSubview:jiFenShangChengLab];
    
    UILabel *duiHuan=[[UILabel alloc] initWithFrame:CGRectMake(jiFenShangChengLab.frame.origin.x, jiFenShangChengLab.frame.size.height+jiFenShangChengLab.frame.origin.y, jiFenShangChengLab.frame.size.width, jiFenShangChengLab.frame.size.height)];
    duiHuan.text=@"兑换优惠券";
    duiHuan.textColor=[UIColor colorWithRed:201/255.0 green:200/255.0 blue:200/255.0 alpha:1];
    duiHuan.font=[UIFont systemFontOfSize:12];
    [jiFenShangCheng addSubview:duiHuan];

    UIView *lineFirst=[[UIView alloc] initWithFrame:CGRectMake(15, huiYuan.frame.size.height+huiYuan.frame.origin.y, self.view.frame.size.width, 1)];
    lineFirst.backgroundColor=LINE_COLOE_245;
    [scrollView addSubview:lineFirst];
    
    UIView *shouChang=[[UIView alloc] initWithFrame:CGRectMake(0, lineFirst.frame.origin.y+1, self.view.frame.size.width, 50*kScrenHidth)];
    [shouChang addGestureRecognizer:[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(myShouChang)]];
    
    
    [scrollView addSubview:shouChang];
    shouChang.backgroundColor=[UIColor whiteColor];
    UIImageView *shouChangImg=[[UIImageView alloc] initWithFrame:CGRectMake(30, 15, 20, 20)];
    [shouChangImg setImage:[UIImage imageNamed:@"shou"]];
    [shouChang addSubview:shouChangImg];
    
    UILabel *myShouChang=[[UILabel alloc] initWithFrame:CGRectMake(shouChangImg.frame.size.width+shouChangImg.frame.origin.x+15, 15, self.view.frame.size.width/3, 20)];
    myShouChang.text=@"我的收藏";
    myShouChang.textColor=[UIColor blackColor];
    myShouChang.font=[UIFont systemFontOfSize:14];
    [shouChang addSubview:myShouChang];
    
    UIImageView *shouChangJianTou=[[UIImageView alloc] initWithFrame:CGRectMake(self.view.frame.size.width-25-10, 20, 10, 15)];
    [shouChangJianTou setImage:[UIImage imageNamed:@"箭头"]];
    [shouChang addSubview:shouChangJianTou];
    
    UIView *line2=[[UIView alloc] initWithFrame:CGRectMake(15, shouChang.frame.size.height+shouChang.frame.origin.y+1, self.view.frame.size.width, 1)];
    line2.backgroundColor=LINE_COLOE_245;
    [scrollView addSubview:line2];
    
    UIView *myDiZhi=[[UIView alloc] initWithFrame:CGRectMake(0, line2.frame.origin.y+1, self.view.frame.size.width, 50*kScrenHidth)];
    [myDiZhi addGestureRecognizer:[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(myDiZhi)]];
    [scrollView addSubview:myDiZhi];
    myDiZhi.backgroundColor=[UIColor whiteColor];
    UIImageView *myDiZhiImg=[[UIImageView alloc] initWithFrame:CGRectMake(30, 14, 20, 23)];
    [myDiZhiImg setImage:[UIImage imageNamed:@"dingx2"]];
    [myDiZhi addSubview:myDiZhiImg];
    
    UILabel *myDiZhiLab=[[UILabel alloc] initWithFrame:CGRectMake(myDiZhiImg.frame.size.width+myDiZhiImg.frame.origin.x+15, 15, self.view.frame.size.width/3, 20)];
    myDiZhiLab.text=@"我的地址";
    myDiZhiLab.textColor=[UIColor blackColor];
    myDiZhiLab.font=[UIFont systemFontOfSize:14];
    [myDiZhi addSubview:myDiZhiLab];
    
    UIImageView *myDiZhiJianTou=[[UIImageView alloc] initWithFrame:CGRectMake(self.view.frame.size.width-25-10, 20, 10, 15)];
    [myDiZhiJianTou setImage:[UIImage imageNamed:@"箭头"]];
    [myDiZhi addSubview:myDiZhiJianTou];
    
    UIView *line3=[[UIView alloc] initWithFrame:CGRectMake(15, myDiZhi.frame.size.height+myDiZhi.frame.origin.y+1, self.view.frame.size.width, 1)];
    line3.backgroundColor=LINE_COLOE_245;
    [scrollView addSubview:line3];
    
    UIView *keFu=[[UIView alloc] initWithFrame:CGRectMake(0, line3.frame.origin.y+1, self.view.frame.size.width, 50*kScrenHidth)];
    [keFu addGestureRecognizer:[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(keFu)]];
    [scrollView addSubview:keFu];
    keFu.backgroundColor=[UIColor whiteColor];
    UIImageView *keFuImg=[[UIImageView alloc] initWithFrame:CGRectMake(30, 15, 20, 20)];
    [keFuImg setImage:[UIImage imageNamed:@"客服"]];
    [keFu addSubview:keFuImg];
    
    UILabel *keFuLab=[[UILabel alloc] initWithFrame:CGRectMake(keFuImg.frame.size.width+keFuImg.frame.origin.x+15, 15, self.view.frame.size.width/3, 20)];
    keFuLab.text=@"客服/反馈";
    keFuLab.textColor=[UIColor blackColor];
    keFuLab.font=[UIFont systemFontOfSize:14];
    [keFu addSubview:keFuLab];
    
    UIImageView *keFuJianTou=[[UIImageView alloc] initWithFrame:CGRectMake(self.view.frame.size.width-25-10, 20, 10, 15)];
    [keFuJianTou setImage:[UIImage imageNamed:@"箭头"]];
    [keFu addSubview:keFuJianTou];
    
    UIView *line4=[[UIView alloc] initWithFrame:CGRectMake(15, keFu.frame.size.height+keFu.frame.origin.y+1, self.view.frame.size.width, 1)];
    line4.backgroundColor=LINE_COLOE_245;
    [scrollView addSubview:line4];
    
    
    UIView *pingJia=[[UIView alloc] initWithFrame:CGRectMake(0, line4.frame.origin.y+1, self.view.frame.size.width, 50*kScrenHidth)];
    [pingJia addGestureRecognizer:[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(pingJia)]];
    [scrollView addSubview:pingJia];
    pingJia.backgroundColor=[UIColor whiteColor];
    UIImageView *pingJiaImg=[[UIImageView alloc] initWithFrame:CGRectMake(30, 15, 20, 20)];
    [pingJiaImg setImage:[UIImage imageNamed:@"pingx2"]];
    [pingJia addSubview:pingJiaImg];
    
    UILabel *pingJiaLab=[[UILabel alloc] initWithFrame:CGRectMake(pingJiaImg.frame.size.width+pingJiaImg.frame.origin.x+15, 15, self.view.frame.size.width/3, 20)];
    pingJiaLab.text=@"我的评价";
    pingJiaLab.textColor=[UIColor blackColor];
    pingJiaLab.font=[UIFont systemFontOfSize:14];
    [pingJia addSubview:pingJiaLab];
    
    UIImageView *pingJiaJianTou=[[UIImageView alloc] initWithFrame:CGRectMake(self.view.frame.size.width-25-10, 20, 10, 15)];
    [pingJiaJianTou setImage:[UIImage imageNamed:@"箭头"]];
    [pingJia addSubview:pingJiaJianTou];
    
    UIView *line5=[[UIView alloc] initWithFrame:CGRectMake(15, pingJia.frame.size.height+pingJia.frame.origin.y+1, self.view.frame.size.width, 1)];
//    line5.backgroundColor=[UIColor colorWithRed:201/255.0 green:200/255.0 blue:200/255.0 alpha:1];
    [scrollView addSubview:line5];
    
    scrollView.contentSize=CGSizeMake(self.view.frame.size.width, pingJia.frame.size.height+pingJia.frame.origin.y+2);

//    UIButton *firstBtn=[[UIButton alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width/3, 40)];
//    [firstBtn setTitle:@"0.00" forState:lineFirst];
//    [firstBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
//    firstBtn.titleLabel.font=[UIFont systemFontOfSize:14];
//    [secondView addSubview:firstBtn];
//    
//    UIButton *secondBtn=[[UIButton alloc] initWithFrame:CGRectMake(0, firstBtn.frame.size.height+firstBtn.frame.origin.y, self.view.frame.size.width/3, 40)];
//    [secondBtn setTitle:@"余额" forState:UIControlStateNormal];
//    [secondBtn setTintColor:[UIColor colorWithRed:201/255.0 green:200/255.0 blue:200/255.0 alpha:1]];
//    secondBtn.titleLabel.font=[UIFont systemFontOfSize:10];
//    [secondView addSubview:secondBtn];
    
    
    
}
- (void)pingJia{
    
}

- (void)keFu{
    FeedBackVC *feedVC=[[FeedBackVC alloc] init];
    [self.navigationController pushViewController:feedVC animated:YES];
}

- (void)myDiZhi{
    MyAddressViewController *feedVC=[[MyAddressViewController alloc] init];
    [self.navigationController pushViewController:feedVC animated:YES];
}

- (void)myShouChang{
    ShopCollectTableViewController *shopVC=[[ShopCollectTableViewController alloc] init];
    [self.navigationController pushViewController:shopVC animated:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)leftButtonClick{
    SettingViewController *vc = [[SettingViewController alloc]init];
    [self.navigationController pushViewController:vc animated:YES];
}

- (void)rightButtonClick{
    NewsViewController *vc = [[NewsViewController alloc]init];
    [self.navigationController pushViewController:vc animated:YES];
}

- (void)touxiangButtonClick{
    [self.navigationController pushViewController:_infoVC animated:YES];
    [_infoVC httpGetData];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
